﻿package com.tszs.AlipayUtils;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id ="2016092400585116";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQCwYSCRfnntQdwmbQkTAg/d2O3mu/XLVEBQaQplzWklM0oqKesO0cfqFLJDodYkXJhfe4sxk4XOKnnQwI3B6b/U3SVJ8IeSFJ69WheUX9e8LlxKSNjgCXt1x78u4QHFoFbNky0qMzXJKwwUh3DqQ3zdszlzdt25NTixq95ZWC/Z31u/QaSzF90uxAiXh9UyEFQIQeEBhjk3378KasFIJV2ZqCh05rU8CxyUe1BN4cjbu5ztR96YjeDHfWoph79RY0v8ogTHnzWcZbeuJmeV0mE5CWYrYakLSLwEW8OHIuPnILvFW6DMZwjbA5YZzupICbJKiNWA/4K8594Ej2BkGaJTAgMBAAECggEBAKNFJZrJEyC3SI0hfbbkv79C4eYms/7GPMqykXdvUBephMvHBdowAvkCs4m7s7jxJfOtL0pzHvebhivhMtgAAx2OoMfzKevlvpPVY+JrXg7Kc5AoIuownOKIRsekbbl9FR0zUimwQee4O3R9c97HHj0zfMkPjWu2goalbCwUYCcy+HdlpjT/r4XhtqO1Av9uszlApGbfmhzyFuxMgE9ZCytkvEKX0PpbKRA3OlaZnhaeoqj4Q0lBs1Qe5d1i+trnxryj9XcpikXt+nP72YC2/upV9UsH0BLBiSzqiU4HupwfObE7v8G5yoUZejOGm9fG2nemS8XP+ReL2iKh4pJggQECgYEA82YYShXVYY3l8A0TH0hVixvcmctZ5AjanGXs/PnI5Cuj2LoHALVXq2/HyZM8kifp5qq9YFzpAwQVI/O/aYxCteMSEI7MouZ2xSW7jmaVsLqZbylyCw71vod7hTnnd2PWYMz4FoLhLHq2t+C9Ia+wJ1Q+XnapyyxW+yKrZ08BjJMCgYEAuYLJEVAsH8O8KGbB9K1E7B3yBO/jQhDHqVRO/d+k5riuz49O23L6FZWOGj8bHNv0gv2eb1bKSyz8hnfpgHmj7yUWg++jWOA/rfPRsjdcwvztXODhtDRw6uBfSwA/62Utr8dFvE+tZCH3Ciwi8a1/Icsea79mdR8Qxg8Vs+ju60ECgYEAwb10fBQhA0P10Tw3CmGDZfVJhUmuRaseh/tBxqP02lo6U1rQFCpEnHufZb5DKnuG3Uru7vNFrlbjlPiCVjuFJk6WpINmNAyKYacFQfY6FLCTTT6KPm8sAPrKwWMz8X6QuACvQQvwvHz5UCgdo+C6sLOH6Z0+zjB/E+umz9a9fu0CgYEAuDEaUP1ogjWHahn1NGqhx0tIVQyWea9Nf1w9ficDhS4UK/QfmRbFJo8y4+6KjhH66eDF4cir3Q6SwTTofG7KjZUmkONsLb+imqY/LBN6IASf7RtAHvv+rccP9tkNnjz8qs5R+FKoV4a90bTXEV1xoG0cDGGjamDo965cnyCFsMECgYEAjqbQA6Lzw95/PL5/BwQOPnWTJhD8q11zurJWxNMFzFoVhK/SGaIAR7UmqgLrVWTAIUOvLNMq+XdhTvwhmSrlejjxY0TkW7UYz5Lguh4yGQBppaf2EgWJB9TeBYmPDiUp2zbW1JK/DmroL5sQ9LfUxkoE+9O4pPi2Ofg9Pis1KJk=";
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx24hK6Xo3B/x2dhCSlzkMh2J7O/rwOXu0OXuDhtljmf+WsYsQi5aD+I/Z2p1y+lXFWs5y8XZq0z9YqyK3Iucqn3/S912q7q7e5IJuQv5SofopWDJr9q9JnQQA2fjqWvfG5KSVm/SxUPNR3Bz5w+oMMgYOZI2pYwZedgOp9bDPeQAzsrM8dzje5lSqKuwF0RPlNasKEn/Koxj9KflmtzDEuVEZp9mh1m5LmVoJVxe1WSo3NSLqmst69YtjEH5aO8OvOWIxZSqnbQovtBTE+sG+bdH3/cIXB6xYqp+pSo606hnqZQL150JnjqWKCx9ISkuKI7hK2PmAbcZWmc1S0RZyQIDAQAB
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7yO45uHu6NMVi8Q7X2ptA3b1iQnn2u+X/SL39pqHm3gdMwH6s0rSLi+BkAcsBvEkFJcS3oIYacjwgog6BJ+iW74+6ZXwL93kFMK/XW+GFzzqiuvLLEg4WCxGVFn5SbkgMBd27uzNBHM9+fsEBFdvvimhnlzdhJm76K83JOLK4CK3+TFqYv/4OgZjljKxcuNXIm6xgbP8b+emUedAoDZSJRKQYFD19vjDX26gXVLSorModk5qmkXRUQC4jhif1oC4SvrhyzPaTPk3xezxtOZjiuxjxFVpL78pKq0yps5ENivxV17SVSx+9cPb2LopJTHfTEk4ayF8CYxIu8oMBo71KQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://mrc1999.qicp.vip/tszs/notify_url.do";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://mrc1999.qicp.vip/tszs/return_url.jsp";
	
	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";      


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

